﻿<UserControl x:Class="Studio.DocumentDB.ToolBarUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d">
    <UserControl.Resources>
        <Style TargetType="ToolBar">
            <Setter Property="Background" Value="Transparent"/>
        </Style>
        <Style TargetType="{x:Type Image}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UIElement}, AncestorLevel=1}, Path=IsEnabled}"
                             Value="False">
                    <Setter Property="Opacity"
                            Value="0.5" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    <ToolBarTray Background="{StaticResource toolBarColour}">
        <ToolBar Band="1">
            <Button Click="Connect_Click" ToolTip="Connect">
                <Image Source="Images/Connect.png"/>
            </Button>
            <Button Click="Disconnect_Click" ToolTip="Disconnect" IsEnabled="{Binding Accounts.IsAccountSelected}">
                <Image Source="Images/Disconnect.png"/>
            </Button>
            <Separator/>
            <Button Click="Refresh_Click" ToolTip="Refresh" IsEnabled="{Binding Accounts.IsRefreshableSelected}">
                <Image Source="Images/refresh.png"/>
            </Button>
            <Button Click="NewDB_Click" ToolTip="Create DB" IsEnabled="{Binding Accounts.IsDatabaseFolderSelected}">
                <Image Source="Images/create-db.png"/>
            </Button>
            <Button Click="RemoveDB_Click" ToolTip="Remove DB" IsEnabled="{Binding Accounts.IsDatabaseSelected}">
                <Image Source="Images/delete-db.png"/>
            </Button>
            <Button Click="NewCollection_Click" ToolTip="Create Collection" IsEnabled="{Binding Accounts.IsCollectionFolderSelected}">
                <Image Source="Images/create-collection.png"/>
            </Button>
            <Button Click="RemoveCollection_Click" ToolTip="Remove Collection" IsEnabled="{Binding Accounts.IsCollectionSelected}">
                <Image Source="Images/delete-collection.png"/>
            </Button>
            <Button Click="NewDocument_Click" ToolTip="Create document" IsEnabled="{Binding Accounts.IsDocumentFolderSelected}">
                <Image Source="Images/create-doc.png"/>
            </Button>
            <Button Click="DeleteDocument_Click" ToolTip="Remove document" IsEnabled="{Binding Accounts.IsDocumentSelected}">
                <Image Source="Images/delete-doc.png"/>
            </Button>
        </ToolBar>
    </ToolBarTray>
</UserControl>
